"""
@release: fsray-api-alpha
@file: user.schemas.py
@author: lingdubing
@desc: 用户业务模型约束
@character: utf-8
"""

from pydantic import Field, BaseModel

class RegisterModel(BaseModel):
    username: str = Field(..., description="手机号或者邮箱号",
                          pattern=r'^1[3-9]\d{9}$|^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.['
                                  r'a-zA-Z0-9-.]+$')  # 手机号或者邮箱号
    password: str = Field(..., description="密码")
    ver_code: str = Field(..., description="验证码")


class LoginModel(BaseModel):
    username: str = Field(..., description="手机号或者邮箱号",
                          pattern=r'^1[3-9]\d{9}$|^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.['
                                  r'a-zA-Z0-9-.]+$')  # 手机号或者邮箱号
    password: str | None = Field(None, description="密码")
    ver_code: str | None = Field(None, description="验证码")

class UpdatePasswordModel(BaseModel):
    username: str = Field(..., description="手机号或者邮箱号",
                          pattern=r'^1[3-9]\d{9}$|^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.['
                                  r'a-zA-Z0-9-.]+$')  # 手机号或者邮箱号
    password: str | None = Field(None, description="新密码")
    ver_code: str | None = Field(None, description="验证码")

class UserPaingtionModel(BaseModel):
    page: int = Field(1, description="页码")
    page_size: int = Field(10, description="每页数量")
    user_id : str | None = Field(None, description="用户编号")
    user_role_id: int | None = Field(None, description="用户角色编号")
    user_status: int | None = Field(None, description="用户状态")


